home *** CD-ROM | disk | FTP | other *** search
/ Carousel / CAROUSEL.cdr / mactosh / john / hc_xcmd_.hqx / Searchreplace XCMD v.2.0 / card_11595.txt < prev    next >
Text File  |  1989-09-12  |  1KB  |  18 lines

  1. -- card: 11595 from stack: in.0
  2. -- bmap block id: 6374
  3. -- flags: 4000
  4. -- background id: 11496
  5. -- name: Searchreplace in Hypertalk
  6.  
  7.  
  8. -- part contents for background part 1
  9. ----- text -----
  10.  
  11. Sometimes you may want to perform the functions of the searchreplace XCMD from a script without loading the XCMDΓÇÖs window. In this case, there is no reason to use the XCMD at all, since its purpose is to provide an interactive window. In its place, you can use hypertalk scripts that are essentially what the XCMD sends back to hypercard to perform the search and replace functions. There are two handlers. The first handler is called from a script with the form
  12.  
  13. search Find What String, find method
  14.  
  15. where search is the handler keyword, Find What String is the string to be searched for, and find method is the method to do the search, either string or whole. A space is required after search as well as a comma after the first argument. You need double neutral quotation marks (") around the first argument if it is more than one word. If the find is successful, it puts the start and end character positions of the string it found into a global variable. You can replace this string by calling a second handler from a script with the form
  16.  
  17. replace ReplaceWithString
  18.